package com.woniu.zsd.order.mapper;

import com.woniu.zsd.order.entity.OrderInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.zsd.order.from.AdminUpdateOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2025-03-27
 */
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {

    @Update("update order_info set total_amount=#{bigDecimal} where order_number=#{orderNum}")
    void upAllPrice(@Param("bigDecimal") BigDecimal bigDecimal,@Param("orderNum") String orderNum);

    @Select("select * from order_info where order_number=#{OrderNumber}")
    OrderInfo findOrderByNumber(String orderNumber);

    @Update("update order_info set order_state=5,end_time=#{endTime} where order_number=#{orderNumber}")
    void updateStateByOrderNumber(OrderInfo info);
    @Update("update order_info set order_state=3 where order_number=#{orderNumber}")
    void updateState(String orderNumber);

    @Update("update order_info set order_state=7,site_id=#{siteId} where order_number=#{orderNum}")
    void adminUpdateOrder(AdminUpdateOrder auo);

    @Update("update order_info set order_state=1,site_id=#{siteId} where order_number=#{orderNum}")
    void updateOrderState(String orderNumber);

    @Update("update order_info set order_state=7 where order_number=#{orderNum}")
    void WorkUpdateState(String orderNumber);
}
